package DAO;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import MODEL.Vacinacao;

public class VacinacaoDAO {
	public boolean CadastrarVacinacao(Vacinacao vacinacao) throws InstantiationException, Throwable{
		Connection conn=null;
		PreparedStatement stmt=null;
		Conexao com=new Conexao();
		
		boolean status=false;
		
		try{
			
			conn=com.getConnection();
			
		}catch (SQLException e) {
			e.printStackTrace();
		}
		try{
			stmt=conn.prepareStatement("Insert into vacinacao(IdAnimal,Data_da_Vacinacao,Tipo_de_vacina,Marca,Partida,Lote,Vencimento,Reforco) value(?,?,?,?,?,?,?,?)");
			stmt.setInt(1,vacinacao.getIdAnimal());
			stmt.setString(2,vacinacao.getDatadaVacinacao());
			stmt.setString(3,vacinacao.getTipo());
			stmt.setString(4,vacinacao.getMarca() );
			stmt.setString(5,vacinacao.getPartida() );
			stmt.setString(6,vacinacao.getLote() );
			stmt.setString(7,vacinacao.getVencimento() );
			stmt.setString(8,vacinacao.getReforco() );
				
			stmt.execute();
			
			status=true;
		}catch (SQLException e) {
			e.printStackTrace();
		}
		
		return status;
	}
	

}
